<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加客户 - 汽车维修管理系统</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
</head>
<body>
<style>
    .navbar {
        border-radius: 10px;
        background-color: #343a40;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        transition: all 0.3s ease-in-out;
    }

    .navbar:hover {
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    }

    /* 增加一些 padding 和 margin 让内容不那么拥挤 */
    .navbar-brand {
        font-weight: bold;
        font-size: 1.25rem;
        color: #ffffff;
        text-transform: uppercase;
        transition: color 0.3s ease;
    }

    .navbar-brand:hover {
        color: #2980b9;
    }

    /* 菜单项样式 */
    .navbar-nav .nav-item .nav-link {
        color: #ffffff;
        font-weight: 500;
        padding: 12px 8px;
        transition: background-color 0.3s ease, color 0.3s ease;
    }

    .navbar-nav .nav-item .nav-link:hover,
    .navbar-nav .nav-item .nav-link:focus {
        color: #ffffff;
        background-color: #2980b9;
        border-radius: 5px;
    }

    .navbar-nav .nav-item.active .nav-link {
        color: #fff;
        background-color: #2980b9;
        border-radius: 5px;
    }

    /* 用户信息和退出登录 */
    .navbar-nav.ms-auto .nav-link {
        color: #ffffff;
        font-weight: 500;
        padding: 12px 20px;
    }

    .navbar-nav.ms-auto .nav-link:hover {
        background-color: #2ecc71;
        color: #fff;
        border-radius: 5px;
    }

    /* 自适应 */
    @media (max-width: 768px) {
        .navbar-collapse {
            margin-top: 10px;
        }
    }
    :root {
        --primary-color: #3498db;
        --secondary-color: #2ecc71;
        --dark-color: #2c3e50;
        --light-color: #ecf0f1;
        --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    body {
        background-color: #f8f9fa;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    .container {
        max-width: 1270px;

    }

    .card {
        border: none;
        border-radius: 10px;
        box-shadow: var(--shadow);
        margin-bottom: 25px;
        overflow: hidden;
    }

    .card-header {
        background-color: var(--dark-color);
        color: white;
        font-weight: 600;
        padding: 15px 20px;
        border-bottom: none;
    }

    .table-responsive {
        border-radius: 0 0 10px 10px;
        overflow: hidden;
    }

    .table {
        margin-bottom: 0;
    }

    .table thead th {
        background-color: var(--dark-color);
        color: white;
        position: sticky;
        top: 0;
    }

    .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(0, 0, 0, 0.02);
    }

    .table-hover tbody tr:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .btn-primary {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }

    .btn-outline-primary {
        color: var(--primary-color);
        border-color: var(--primary-color);
    }

    .btn-outline-primary:hover {
        background-color: var(--primary-color);
        color: white;
    }

    .btn-outline-danger:hover {
        background-color: #e74c3c;
        color: white;
    }

    .alert {
        border-radius: 8px;
        border: none;
    }

    .input-group {
        box-shadow: var(--shadow);
    }

    .form-control:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
    }

    .badge {
        font-weight: 500;
        padding: 0.5em 0.75em;
    }

    .badge.bg-warning {
        background-color: #f39c12 !important;
        color: white;
    }

    .badge.bg-success {
        background-color: #2ecc71 !important;
    }

    .pagination .page-item.active .page-link {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }

    .pagination .page-link {
        color: var(--dark-color);
    }

    @media (max-width: 768px) {
        .container {
            padding: 15px;
        }

        .card-header {
            flex-direction: column;
            align-items: flex-start;
        }

        .card-header h5 {
            margin-bottom: 10px;
        }

        .btn-group {
            flex-wrap: wrap;
        }

        .table-responsive {
            overflow-x: auto;
        }
    }
</style>
<div th:insert="~{common/common::topbar}"></div>

<div class="container mt-4">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h5 class="card-title">添加客户</h5>
                    <a th:href="@{/customer/list}" class="btn btn-outline-secondary btn-sm">返回列表</a>
                </div>
                <div class="card-body">
                    <form th:action="@{/customer/add}" th:object="${customer}" method="post">
                        <div class="mb-3">
                            <label for="customer_name" class="form-label">客户名称</label>
                            <input type="text" class="form-control" id="customer_name"
                                   th:field="*{customer_name}" required>
                        </div>

                        <div class="mb-3">
                            <label for="phone" class="form-label">联系电话</label>
                            <input type="tel" class="form-control" id="phone"
                                   th:field="*{phone}" required>
                        </div>

                        <div class="mb-3">
                            <label for="address" class="form-label">居住地址</label>
                            <input type="text" class="form-control" id="address"
                                   th:field="*{address}">
                        </div>

                        <div class="mb-3">
                            <label for="email" class="form-label">电子邮箱</label>
                            <input type="email" class="form-control" id="email"
                                   th:field="*{email}">
                        </div>

                        <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                            <a th:href="@{/customer/list}" class="btn btn-secondary me-md-2">取消</a>
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>